
Unicode and Encodings

                                               version: 0.1
                                               created: 01/18/2001 {15:20:17 PM}
                                           last update: 02/27/2001 {05:00:26 AM}


Alphatk and Alpha 8 make use of Tcl's built in support for unicode, Utf-8,
and in general any well-defined character encoding, including platform
dependent encodings such as 'macRoman'.  See <http://www.unicode.org> for a
general introduction to unicode.

	  	Editing files

Any text file whose first line contains text of the form 'encoding:xxx' will
have its characters read in the encoding 'xxx' when Alpha(tk) tries to edit
the file, and similarly when the file is saved.  However some encodings,
such as unicode itself, may use multiple bytes to represent a single
character, and in this cases Alpha(tk) may not recognise the existence of a
string such as 'encoding:xxx' even if it is given!  This is only normally a
problem with the unicode encoding, but fortunately it can be solved in a
different way: unicode files always begin with the (hexadecimal) sequence
'fffe' or 'feff'.  Alpha(tk) will automatically recognise this, read the
rest of the file in binary form, and treat it as unicode using the
appropriate byte-ordering for the file (this is an additional complication:
some platforms save the high byte first, others the low byte!).  When saving
unicode files, Alpha(tk) currently only saves using the byte-ordering of the
host platform.

There are two other ways in which you may specify the encoding Alpha(tk)
should use for a file: 

(1) the 'fileset encoding preference' feature (turn it on in the usual
'Config -> Preferences -> Features' dialog) can be used to declare a default
encoding for any fileset.

(2) the popup 'encoding' menu (once a file is open, there is a popup menu in
the status bar which you can use to select a new encoding to use for the
file).  If you change the encoding, Alpha(tk) will offer an option to
re-read the file from disk using the new encoding.

Of course, whenever you save a file to disk, Alpha(tk) will use the
encoding currently set for window.

You can use 'getWinInfo ?-w win? arr' to access a window's encoding
through $arr(encoding).

Note: Alpha 8 probably does not necessarily support all of the above at
present.  It should all work in Alphatk however.

	  	Sourcing files

Alpha(tk) does not currently handle sourcing of files in general encodings.
Tcl itself lacks this support.  It may be added in the future (as an
extension of Alphatk's current approach of treating all files in Alpha's
hierarchy as macRoman, and all files outside that hierarchy as
platform-native).
